﻿using System.Collections.Generic;
using System.Web.Mvc;
using Common.Helpers;
using Common.Objects.Column;
using Common.WebApplication;
using EYCmsAdmin.Domain.Models;
using EYCmsAdmin.Presentation.Models.BaseModels;
using Tools.Utilities;

namespace EYCmsAdmin.Presentation.Models.UserModels
{
    public class UserSelectItem : BaseSelectItemModel
    {
        public UserSelectItem(User user)
        {
            string baseUrl = ApplicationUtils.GetBaseUrl();
            Items = new List<IBaseColumn>()
                        {
                            new StringColumn(user.Login),
                            new StringColumn(user.Email),
                            new StringColumn(user.UserInfo.Name),
                            new StringColumn(user.UserInfo.Surname),
                            new ImageLinkListColumn(new[]
                            {
                                new ImageLinkColumn(string.Concat(baseUrl,"User/Edit/", user.Id), "Edit", ApplicationUtils.GetIconUrl("edit.png")),
                                new ImageLinkColumn(string.Concat(baseUrl,"User/Delete/", user.Id), "Delete", ApplicationUtils.GetIconUrl("delete.png"))
                            })
                        };
        }
    }
}